cmake_minimum_required(VERSION 3.0)
project(git-secure)

if(NOT DEFINED GITSECURE_VERSION_MAJOR)
  set(GITSECURE_VERSION_MAJOR 1)
endif()
if(NOT DEFINED GITSECURE_VERSION_MINOR)
  set(GITSECURE_VERSION_MINOR 0)
endif()
if(NOT DEFINED GITSECURE_VERSION_PATCH)
  set(GITSECURE_VERSION_PATCH 0)
endif()

if (NOT PACKAGE_VERSION)
  set(PACKAGE_VERSION
    "${GITSECURE_VERSION_MAJOR}.${GITSECURE_VERSION_MINOR}.${GITSECURE_VERSION_PATCH}")
endif()

set(CPACK_PACKAGE_NAME "git-secure")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "git-secure")
set(CPACK_PACKAGE_VERSION_MAJOR ${GITSECURE_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${GITSECURE_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${GITSECURE_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION ${PACKAGE_VERSION})
set(CPACK_PACKAGE_VENDOR "git-secure")
set(CPACK_PACKAGE_CONTACT "Force Charlie")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Force Charlie")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "git repository secure tools")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt")
## NSIS
if(WIN32 AND NOT UNIX)
set(CMAKE_INSTALL_PREIFX "${PROGRAMFILES}/git-secure")
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\git-secure.ico")
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\git-secure.ico")
set(CPACK_NSIS_MODIFY_PATH "ON")
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
if( CMAKE_CL_64 )
  set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
endif()
set(CPACK_WIX_PRODUCT_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\git-secure.ico")
set(CPACK_WIX_LICENSE_RTF "${CMAKE_CURRENT_SOURCE_DIR}/license.rtf")
set(CPACK_WIX_UPGRADE_GUID "B1EE3E43-164D-403C-8244-AF95E56B5B44")
#set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
endif()

if(WIN32)
include(InstallRequiredSystemLibraries)
endif()

include(CPack)
if(WIN32 AND NOT UNIX)
  install(PROGRAMS "bin/git-secure.bat"
    DESTINATION bin
  )
else()
  install(PROGRAMS "bin/git-secure"
    DESTINATION bin
  )
endif()


install(PROGRAMS "bin/git-secure.ps1"
  DESTINATION bin
)


install(DIRECTORY ps
  DESTINATION "."
)
install(DIRECTORY Modules
  DESTINATION "."
)

install(PROGRAMS "utils/convert.ps1"
  DESTINATION "utils"
)

